<extend name="Public/base" />
<block name="body">
    <style type="text/css">
        *{margin: 0px;padding: 0px;}
        .all{width: 1700px;height: 1000px;padding-left: 100px;padding-top: 50px;line-height: 45px;}
        .coupon{width: 440px;height:238px;border: 1px solid black;margin-left:94px;padding-left: 80px;padding-top: 32px;line-height: 40px;margin-top: -25px;margin-bottom: 15px;background-color:white;}
        .coupon_last{margin-left: 104px;}
        #f2{width: 300px;height: 30px;}
        .red{color: red;}
        .money{width: 80px;}
        #f3{width: 80px;height: 25px;}
        #f5{width: 200px;height: 25px;}
        .f4{width: 80px;height: 25px;}
        .xianling{margin-left:118px;}
        .xianling_one{margin-left: -71px;}
        .chuangjian{margin-left:118px;}
        .number{margin-left: 56px;}
    </style>
    <div class="all">
        <form method="post" action="{:U('Coupon/addCoupon')}" class="form-horizontal">
            <input type="hidden" value="{$couponinfo.id}" name="id" />
            <div class="ss">
                <span class="red">*</span>优惠券类型：
                <notempty name="couponinfo.id">
                    <input type="hidden" value="{$couponinfo.full_type}" name="full_type" />
                    <input name="full_type" id="wo"  class="manjian" type="radio"  value="1" disabled <eq name="couponinfo.full_type" value="1"> checked="true"  </eq> >满减
                    <input name="full_type" id="ni"  class="zhekou" type="radio" value="2" disabled <eq name="couponinfo.full_type" value="2"> checked="true" </eq>>折扣
                    <input  name="full_type" id="ta"  class="xianjin"  type="radio"  value="3" disabled  <eq name="couponinfo.full_type" value="3"> checked="true" </eq>>现金券
                <else />
                    <input name="full_type" id="wo"  class="manjian" type="radio"  value="1" >满减
                    <input name="full_type" id="ni"  class="zhekou" type="radio" value="2" >折扣
                    <input  name="full_type" id="ta"  class="xianjin"  type="radio"  value="3" >现金券
                </notempty>
            </div>
            <div>
                <span class="red">*</span>优惠券名称：
                <input id="f2" name='title' class="search-input" value="{$couponinfo.title}" placeholder="不超过10个字">
            </div>
            <div>
                <span class="red">*</span>领取时间：
                &nbsp;&nbsp;
                <input name='collection_time'  type="radio" value="1"  <eq name="couponinfo.collection_time" value="1"> checked="true" </eq>>不限时 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <input name='collection_time' type="radio"  value="2" <eq name="couponinfo.collection_time" value="2"> checked="true" </eq>>限时
            </div>
            <div class="qq">


            </div>
            <div class="number">
                <span class="red">*</span>发行量：
                <input id="f3" name='circulation' class="search-input" value="{$couponinfo.circulation}" > 张
            </div>
            <div>
                <span class="red">*</span>可领取用户身份：
                <input name="user_identity" type="radio" value="1" <eq name="couponinfo.user_identity" value="1"> checked="true" </eq> >所有用户 &nbsp; &nbsp; &nbsp;
                <input name="user_identity" type="radio" value="2" <eq name="couponinfo.user_identity" value="2"> checked="true" </eq> >新用户(未经注册用户)
            </div>
            <div class="xianling">
                <div class="xianling_one"><span class="red">*</span>限领设置:&nbsp;&nbsp; 一个用户可领取
                    <input name="collar_setting" class="f4" type="text" placeholder="1"value="{$couponinfo.collar_setting}"> 张</div>
            </div>
            <div>
                直接放入用户账户：
                <input id="f5" name='user_id' class="search-input" value="{$couponinfo.user_id}"placeholder="请输入用户ID">
            </div>
            <div class="chuangjian">
                <input class="btn submit-btn ajax-post" id="sbmit" type="submit" target-form="form-horizontal" value="创建优惠券" />
            </div>
        </form>
    </div>
    <div style="display:none;">
    <!-- 满减 -->
    <div id="full_full" class="full">
        <span class="red">*</span>优惠卷设置：
        <div class="coupon">
            <div>
                <span class="red">*</span>单张面额：
                <input  name='denomination' class="money_six" value="{$couponinfo.denomination}" placeholder="最大输入99999">
            </div>
            <div>
                <span class="red">*</span>使用条件：单笔订单金额满
                <input  name='condition' class="money" type="text"value="{$couponinfo.condition}">元可用使用
            </div>
            <div>
                <span class="red">*</span>适用范围：
                <input name="range" type="radio"value="1" <eq name="couponinfo.range" value="1"> checked="true" </eq>>全场通用
            </div>
            <div>
                <span class="red">*</span>优惠卷有效期：
                <input name="term_of_validity" class="money_one" type="radio"value="1" <eq name="couponinfo.term_of_validity" value="1"> checked="true" </eq>>日期
                <input name="term_of_validity" class="money_tow" type="radio"value="2" <eq name="couponinfo.term_of_validity" value="2"> checked="true" </eq>>周期
            </div>
            <div class="coupon_last">
                <notempty name="couponinfo.start_time">
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="{$couponinfo.start_time}">
                    <else />
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="">
                </notempty>
                至
                <notempty name="couponinfo.end_time">
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="{$couponinfo.end_time}">
                    <else />
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="">
                </notempty>
            </div>
        </div>
    </div>
    <!-- 折扣 -->
    <div id="full_count" class="count">
        <span class="red">*</span>优惠卷设置：
        <div class="coupon">
            <div>
                <span class="red">*</span>单张折扣率：
                <input  name='denomination' class="search-input" value="{$couponinfo.denomination}"> %
            </div>
            <div>
                <span class="red">*</span>使用条件：单笔订单金额满
                <input  name='condition' class="money" type="text"value="{$couponinfo.condition}">元可用使用
            </div>
            <div>
                <span class="red">*</span>适用范围：
                <input name="range" type="radio"value="1"  <eq name="couponinfo.range" value="1"> checked="true" </eq>>全场通用
            </div>
            <div>
                <span class="red">*</span>优惠卷有效期：
                <input name="term_of_validity" class="money_one" type="radio"value="1" <eq name="couponinfo.term_of_validity" value="1"> checked="true" </eq>>日期
                <input name="term_of_validity" class="money_tow" type="radio"value="2" <eq name="couponinfo.term_of_validity" value="2"> checked="true" </eq>>周期
            </div>
            <div class="coupon_last">
                <notempty name="couponinfo.start_time">
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="{$couponinfo.start_time}">
                    <else />
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="">
                </notempty>
                至
                <notempty name="couponinfo.end_time">
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="{$couponinfo.end_time}">
                    <else />
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="">
                </notempty>
            </div>
        </div>
    </div>
    <!-- 现金券 -->
    <div id="full_cash" class="cash">
        <span class="red">*</span>优惠卷设置：
        <div class="coupon">
            <div>
                <span class="red">*</span>单张面额：
                <input  name='denomination' class="search-input" value="{$couponinfo.denomination}" placeholder="最大输入99999">
            </div>
            <div>
                <span class="red">*</span>适用范围：
                <input name="range" type="radio"value="1" <eq name="couponinfo.range" value="1"> checked="true" </eq>>全场通用
            </div>
            <div>
                <span class="red">*</span>优惠卷有效期：
                <input name="term_of_validity" class="money_one" type="radio"value="1" <eq name="couponinfo.term_of_validity" value="1"> checked="true" </eq>>日期
                <input name="term_of_validity" class="money_tow" type="radio"value="2" <eq name="couponinfo.term_of_validity" value="2"> checked="true" </eq>>周期
            </div>
            <div class="coupon_last">
                <notempty name="couponinfo.start_time">
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="{$couponinfo.start_time}">
                    <else />
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="开始时间"  name="start_time" value="">
                </notempty>
                至
                <notempty name="couponinfo.end_time">
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="{$couponinfo.end_time}">
                    <else />
                    <input type="text" class="text date_picker"  style="float:left;line-height:32px;margin-right:5px;" placeholder="结束时间"  name="end_time" value="">
                </notempty>
            </div>
        </div>
    </div>
    </div>
</block>
<block name="style">
    <link href="__PUBLIC__/static/jquery-datetimepicker/jquery-datetimepicker.css" rel="stylesheet" media="screen">
</block>
<block name="script">
    <script type="text/javascript" src="__PUBLIC__/static/jquery-datetimepicker/jquery-datetimepicker.js"></script>
    <script type="text/javascript" charset="utf-8">
        //搜索功能
        $("#search").click(function(){
            var url = $(this).attr('url');
            var query  = $('.search-form').find('input').serialize();
            query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
            query = query.replace(/^&/g,'');
            if( url.indexOf('?')>0 ){
                url += '&' + query;
            }else{
                url += '?' + query;
            }
            window.location.href = url;
        });
        //回车搜索
        $(".search-input").keyup(function(e){
            if(e.keyCode === 13){
                $("#search").click();
                return false;
            }
        });
        $(".qq").html($("#full_full").html());
        $('.date_picker').datetimepicker({
            lang:'ch',
            format:'Y-m-d H:i:s',
            timepicker:true,
            allowBlank:true
        });
        var full_type = {$couponinfo.full_type};
        if(full_type==1){
            $(".qq").html($("#full_full").html());
        }else if(full_type == 2){
            $(".qq").html($("#full_count").html());
        }else if(full_type == 3){
            $(".qq").html($("#full_cash").html());
        }
        $(document).ready(function(){
            $("#wo").click(function(){
                $(".qq").html($("#full_full").html());
            });
            $("#ni").click(function(){
                $(".qq").html($("#full_count").html());
            });
            $("#ta").click(function(){
                $(".qq").html($("#full_cash").html());
            });
        });
    </script>

</block>